<?php

namespace app\admin\model;

use think\Model;
use think\Db;

/*
 * 店铺
 */

class Store extends Model {
    
    /*
     * 生成邀请码
     */
    public static function generateInviteCode()
    {
        $invite_code = 'D'.mt_rand(1000000,9999999);
        $exist = Db::name('store')
            ->where('invite_code', '=', $invite_code)
            ->find();
        if (is_null($exist)) {
            return $invite_code;
        } else {
            self::generateInviteCode();
        }
    }

}
